Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_FIELD_active -> [], get_FIELD_display -> str, similar to Djan… #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zaharazod
Copy link

…go's enum helper method (get_FIELD_display).

@mateuszmandera
Copy link
Contributor

@zaharazod Thanks for submitting this! Can you explain what this does and why?

@zaharazod
Copy link
Author

Hi! Essentially convenience methods. I was originally using Django's builtin enum fields, which provide a handy get_FIELD_display (string representing current selection). These are two such abstractions that, when I transitioned to bitfield, I found I was doing often. _active returns an array of strings for the currently selected bits, and _display reduces them to a comma-separated string (that last is obviously negotiable). Take all/some/none of it, just saved me a little time.

@mast22
Copy link

mast22 commented Oct 13, 2020

Any update on this PR? Actually cool feature, any chance if this will be merged?

@timabbott
Copy link
Collaborator

@mast22 I think a change like this is unlikely to be merged without tests and documentation. (It's also failing CI).

This project's maintainers don't have a huge amount of time for it so I think we're unlikely to do that cleanup work ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants